package com.bsoft.gol.hcs.specialist.dao;

import ctd.persistence.annotation.DAOMethod;
import ctd.persistence.annotation.DAOParam;
import ctd.persistence.support.hibernate.HibernateSupportDelegateDAO;
import com.bsoft.gol.hcs.specialist.entity.DiseaseExtendPropertyEntity;

import java.util.List;

/**
 * 病种扩展属性dao
 *
 * @author niule
 */
public abstract class DiseaseExtendPropertyDAO extends HibernateSupportDelegateDAO<DiseaseExtendPropertyEntity> {

    @DAOMethod(sql = " from DiseaseExtendPropertyEntity where diseaseTypeId =:diseaseTypeId order by createTime")
    public abstract List<DiseaseExtendPropertyEntity> queryDiseaseExtendPropertyByDiseaseTypeId(@DAOParam("diseaseTypeId")Long diseaseTypeId);

    @DAOMethod(sql = " from DiseaseExtendPropertyEntity where diseaseTypeId =:diseaseTypeId and parentId is null  order by createTime")
    public abstract List<DiseaseExtendPropertyEntity> queryFirstDiseaseByDiseaseTypeId(@DAOParam("diseaseTypeId")Long diseaseTypeId);

    @DAOMethod(sql = " from DiseaseExtendPropertyEntity where diseaseTypeId =:diseaseTypeId and  parentId=:extendId order by createTime")
    public abstract List<DiseaseExtendPropertyEntity> querySecondDiseaseByDiseaseTypeId(@DAOParam("diseaseTypeId")Long diseaseTypeId,@DAOParam("extendId")Long extendId);

    @DAOMethod(sql = " select extendId from DiseaseExtendPropertyEntity where parentId =:parentId ")
    public abstract List<Long> queryExtendIdByParentId(@DAOParam("parentId")Long parentId);

    @DAOMethod(sql = " delete from DiseaseExtendPropertyEntity where diseaseTypeId =:diseaseTypeId ")
    public abstract void deleteDiseaseExtendPropertyByDiseaseTypeId(@DAOParam("diseaseTypeId")Long diseaseTypeId);

    @DAOMethod(sql = " delete from DiseaseExtendPropertyEntity where extendId in (:extendIdList) ")
    public abstract void deleteDiseaseExtendPropertyById(@DAOParam("extendIdList")List<Long> extendIdList);
}
